#include "../../include/main/test1.hpp"



std::mutex screen_mutex;

int main(){
    // 初始化第一步，初始化窗口
    auto result= drawer::initDrawer(windowWidth,windowHeight);
    if (result.status!=Result<GLFWwindow *, std::string>::Status::Ok){
        std::cout<<result.error<<std::endl;
        return 0;
    }
    auto window=result.value;

    // 初始化第二步，初始化屏幕
    auto screen=drawer::Screen();

    // 初始化第三步，初始化世界
    auto world=object::generateWorld3();

    // 开始进入线程，对屏幕内容进行修改
    std::thread handle(handler::MainHandler<object::ColorWorld>, std::ref(screen), std::ref(screen_mutex),std::ref(world));

    // 开始进行循环绘制屏幕内容
    drawer::loopDraw(window,screen,screen_mutex);

    
    drawer::destroyDrawer(window);
    handle.detach();
    // 结束前，清理资源
    return 0;
}